Last modified attribute

Hello,

I am quite new to DXL development, and I got this ideea that will make my life a lot easier... that being to be able to return the name (and date) of the last modified attribute? I was thinking that a trigger might be able to write this info into an attribute, but for me triggers are uncharted territory.

Does anyone have an ideea on how I can reliably return the last modified attribute and date of modification?

Help is much appreciated.

Dan.
cugetare - Mon Mar 05 03:24:47 EST 2012

Re: Last modified attribute
llandale - Tue Mar 06 10:49:48 EST 2012

Seems you want to search through History, something like this

History hst
HistoryType ht
string NameAttr = "", NameUser = ""
Date   datHist  = null
for hst in current Module do
{  ht = hst.type
   if (ht == modifyObject)
   {  NameAttr = hst.attrName
      datHist  = hst.date
      NameUser = hst.author
   }
}
print "Last modification\ton: " datHist "\tof: " NameAttr "\tby: " NameUser "\n"


-Louie

Yes, avoid triggers for now.

Re: Last modified attribute
cugetare - Wed Mar 07 06:51:01 EST 2012

Thanks Louie,

I just opened the page to post a solution i found, only to find that you answered my question.
What's funny though is that i used a very similar approach, using hystory, but I was thinking that the attribute "Last modified on" changes on any modification of an object and by comparing the history date with the last modif. i can assume that the respective attribute was the last one modified... anyway this is my code... feel free to comment
 

string checkMod(){
    string retVal = ""
 
        /*                      modify code here                */
        History h 
        string att 
        Date dt, lm
        for h in o do {
                HistoryType ht = h.type 
                if (ht==modifyObject) { 
                        att = h.attrName 
                        if (att == "Object Text"){
                                dt = dateOnly(h.date)
                                lm = o."Last Modified On"
                                if (dt == lm){
                                        print (o."Pool-ID")": "dt " vs " lm"\n"
                                        retVal = "changed"
                                }else{
                                        retVal = "same"
                                }
                        }
            }
        }
        return retVal
}

 


Dan.